package com.twt.recruit.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.twt.recruit.entity.ProjectGroup;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ProjectGroupMapper extends BaseMapper<ProjectGroup> {


    @Select("select group_id from project_group where project_id = #{projectId}")
    List<Integer> getGroupIdsByProjectId(Integer projectId);

    @Select("select question_id from question where project_id = #{projectId}")
    List<Integer> getQuestionIds(Integer projectId);


    @Select("select option_id from question_option where question_id = #{questionId}")
    List<Integer> getOptionIds(Integer questionId);

    @Delete("delete from project_group where project_id = #{projectId}")
    void delProjectGroupByProjectId(Integer projectId);

    @Select("select group_name from group_info where group_id in (select group_id from project_group where project_id = #{projectId})")
    List<String> getGroupsByProjectId(Integer projectId);

    @Delete("delete from project_group where project_id = #{projectId} and group_id = #{groupId}")
    void delOneProjectGroup(Integer projectId, Integer groupId);
}
